<source>
  type tail
  path /var/lib/docker/containers/*/*-json.log
  pos_file /var/log/td-agent/tmp/fluentd-docker.pos
  time_format %Y-%m-%dT%H:%M:%S
  tag docker.*
  format json
  read_from_head true
</source>

<match docker.var.lib.docker.containers.*.*.log>
  type kubernetes
  container_id ${tag_parts[5]}
  tag docker.${name}
</match>

<match kubernetes>
  type copy

  <store>
    type forward
    send_timeout 60s
    recover_wait 10s
    heartbeat_interval 1s
    phi_threshold 16
    hard_timeout 60s
    log_level trace
    require_ack_response true
    heartbeat_type tcp

    <server>
      name {{groups['oo_first_master'][0]}}
      host {{hostvars[groups['oo_first_master'][0]].openshift.common.hostname}}
      port 24224
      weight 60
    </server>

    <secondary>
      type file
      path /var/log/td-agent/forward-failed
    </secondary>
  </store>

  <store>
    type file
    path /var/log/td-agent/containers.log
    time_slice_format %Y%m%d
    time_slice_wait 10m
    time_format %Y%m%dT%H%M%S%z
    compress gzip
    utc
  </store>
</match>
